import java.util.ArrayList;
import java.util.List;

public class demo1 {
    public static void main(String[] args) {
        String s=new String("ab&&2&&&");
        String[] ret=func(s,"&&");
        System.out.println("11111");
        String x=fund(ret);
        System.out.println("aaaaaaaa");
    }
    public static String[] func(String s,String sign){
        if(s.length()==0) return null;
        List<String> ret=new ArrayList<>();
        int left=0;
        int right=0;
        int i=0;
        for(right=0;right<s.length();right++){
            if(right+1<s.length()&&s.charAt(right)=='&'&&s.charAt(right+1)=='&'){
                if(left!=right){
                    String temp=s.substring(left,right);
                    ret.add(temp);
                }
                left=right=right+2;
            }
        }
        if(left<s.length()&&right<s.length()+1&&left!=right){
            ret.add(s.substring(left,right));
        }
        String[] sret=new String[ret.size()];
        i=0;
        for(String x:ret){
            sret[i++]=x;
        }
        return sret;
    }

    public static String fund(String[] temp){
        if(temp.length==0) return null;
        StringBuilder sbu=new StringBuilder();
        for(String x:temp){
            sbu.append(x);
        }
        return sbu.toString();
    }


}
